<template>
  <view class="container">
    <!-- 这里放一组轮播图 -->
    <up-swiper :list="list1"></up-swiper>
    <!-- 点餐按钮
    <view class="order"> <view>点我去点餐咯</view> </view> -->
    <!-- 日历 -->
    <view class="daycount">
      <view class="title">纪念日还有</view>
      <view class="count">{{ days }} 天</view>
      <view class="now">{{ Today() }}</view>
    </view>
    <!-- 每日一句部分 -->
    <view class="quote">{{ oneSentence }}</view>
  </view>
</template>
<script setup lang="ts">
import { reactive, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { daysUntil, Today } from '@/common/date'
import { getList } from '@/api/home'

// 使用 reactive 创建响应式数组
const list1 = reactive([
  'https://img-u-4.51miz.com/preview/video/00/00/11/52/V-115283-4B853216.jpg'
])

const days = ref(daysUntil(11, 22))
const oneSentence = ref('')

onLoad(async () => {
  const res = await getList()
  oneSentence.value = res.data.content
})
</script>

<style lang="scss" scoped>
.container {
  width: 100vw;
  height: 95vh;
  background: url('/static/ui/bg.jpg') no-repeat center;
  .order {
    width: 80%;
    margin: 0 auto;
    border-radius: 16rpx;
    padding: 100rpx 0;
    view {
      padding: 20rpx;
      background-color: #e49db2;
      border-radius: 16rpx;
      text-align: center;
      color: #fff;
    }
  }
  .daycount {
    width: 89%;
    margin: 0 auto;
    padding: 30rpx;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-top: 100rpx;
    margin-bottom: 40rpx;
    border-radius: 22rpx;
    .title {
      padding: 20rpx 0;
      font-size: 50rpx;
      font-weight: 500;
    }
    .count {
      padding: 30rpx 0;
      font-size: 70rpx;
    }
    .now {
      padding: 10rpx 0;
    }
  }
  .quote {
    width: 89%;
    height: auto;
    // 设置最小高度
    min-height: 200rpx;
    margin: 0 auto;
    padding: 30rpx;
    display: flex;
    color: #fff;
    border-radius: 22rpx;
    background-color: rgba(0, 0, 0, 0.1);
  }
}
</style>
